<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<h1>姓名: {{msg.name}}</h1>
			<h1>年龄: {{msg.age}}</h1>
			<button @click="get">Get方法</button>
		</div>
		<script src="../js/axios.min.js"></script>
		<script src="../js/vue.min.js"></script>
		<script type="text/javascript">
			var vm = new Vue({
				el: '#app',
				data: {
					msg: {}
				},
			methods: {
				get() {
					axios.get("a.json", {
						//携带参数的写法
						params: {
							ID: 1
						},
						//请求头中添加参数
						headers: {
							token: "123"
						}
					}).then(
						res => {
							this.msg = res.data;
						}).catch(err => {
							console.log(err)
						})
				}
			}
			});
		</script>
	</body>
</html>
